cmake_minimum_required(VERSION 3.6.0)
if (NOT ROOT_DIR)
    set(ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../")
endif()
set(CURRENT_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/toolchain_common.cmake)
include(${CURRENT_CMAKE_PATH})


# set the other flags
set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lm")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "-lm")
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

add_definitions(-DUSE_HTNICE)

if (NOT COMPILER_ROOT)
    set(COMPILER_ROOT ${ROOT_DIR}/buildtools/toolchains/gcc-linaro-4.9-2014.10-x86_64_arm-linux-gnueabihf)
endif()

set(CMAKE_C_COMPILER   "${COMPILER_ROOT}/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "${COMPILER_ROOT}/bin/arm-linux-gnueabihf-g++")
set(CMAKE_AR           "${COMPILER_ROOT}/bin/arm-linux-gnueabihf-ar")
set(CMAKE_RANLIB       "${COMPILER_ROOT}/bin/arm-linux-gnueabihf-ranlib")
set(CMAKE_STRIP        "${COMPILER_ROOT}/bin/arm-linux-gnueabihf-gnu-strip")
set(CMAKE_SYSTEM_PROCESSOR "arm")

message(INFO " C compiler is ${CMAKE_C_COMPILER}")
message(INFO " CXX compiler is ${CMAKE_CXX_COMPILER}")